/**
 * =================================================================
 * 版权所有 2011-2013 深圳市泰海网络科技服务有限公司，并保留所有权利
 * -----------------------------------------------------------------
 * 这不是一个自由软件！您不能在任何未经允许的前提下对程序代码进行修改和使用；
 * 不允许对程序代码以任何形式任何目的的再发布
 * =================================================================
 */
package com.sfpay.api.request;

import java.util.HashMap;
import java.util.Map;

import com.sfpay.api.ApiRuleException;
import com.sfpay.api.FileItem;
import com.sfpay.api.SfpayUploadRequest;
import com.sfpay.api.internal.util.RequestCheckUtils;
import com.sfpay.api.internal.util.SfpayHashMap;
import com.sfpay.api.response.DeliveryTaskAddResponse;

/**
 * 类说明：<br>
 * 
 * <p>
 * 详细描述：<br>
 * 
 * </p>
 * <pre>
 * ——————————————————————————————————————————————————————————————————
 * |		修改人		|		修改时间			|		修改原因
 * ——————————————————————————————————————————————————————————————————
 * |	354190 曾宪新	|		2013-10-16		|	
 * ——————————————————————————————————————————————————————————————————
 * </pre>
 * 
 * @author 354190 曾宪新(Xavier.zeng)
 * 
 * CreateDate: 2013-10-16
 */
public class DeliveryListCancelRequest implements SfpayUploadRequest<DeliveryTaskAddResponse> {

	private Map<String, String> headerMap = new SfpayHashMap();
	
	private SfpayHashMap udfParams;
	
	private Long timestamp;
	
	/**
	 * 通知接收URL, 不需要异步接收为空
	 */
	private String notifyUrl;
	
	/**
	 * 结果返回URL，仅适用于立即返回处理结果的接口
	 * 请求地址与结果返回地址不一样时，填写returnUrl;为空认为请求地址返回
	 */
	private String returnUrl;
	
	/**
	 * byte[] 为ZIP压缩下单业务参数数组。编码为UTF-8，格式定为XML。
	 */
	private FileItem deliveryInfoList;
	
	public FileItem getDeliveryInfoList() {
		return deliveryInfoList;
	}

	public void setDeliveryInfoList(FileItem deliveryInfoList) {
		this.deliveryInfoList = deliveryInfoList;
	}

	public String getNotifyUrl() {
		return notifyUrl;
	}

	public void setNotifyUrl(String notifyUrl) {
		this.notifyUrl = notifyUrl;
	}

	public String getReturnUrl() {
		return returnUrl;
	}

	public void setReturnUrl(String returnUrl) {
		this.returnUrl = returnUrl;
	}

	public Map<String, String> getHeaderMap() {
		return headerMap;
	}

	public void setHeaderMap(Map<String, String> headerMap) {
		this.headerMap = headerMap;
	}

	public SfpayHashMap getUdfParams() {
		return udfParams;
	}

	public void setUdfParams(SfpayHashMap udfParams) {
		this.udfParams = udfParams;
	}

	public Long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}
	
	@Override
	public String getApiMethodName() {
		return "sfpay.delivery.list.cancel";
	}

	@Override
	public Map<String, String> getTextParams() {
		SfpayHashMap txtParams = new SfpayHashMap();
		txtParams.put("notifyUrl", this.notifyUrl);
		txtParams.put("returnUrl", this.returnUrl);
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	@Override
	public void putOtherTextParam(String key, String value) {
		if(this.udfParams == null) {
			this.udfParams = new SfpayHashMap();
		}
		this.udfParams.put(key, value);
	}

	@Override
	public Map<String, FileItem> getFileParams() {
		Map<String, FileItem> params = new HashMap<String, FileItem>();
		params.put("deliveryInfoList", this.deliveryInfoList);
		return params;
	}
	
	@Override
	public Class<DeliveryTaskAddResponse> getResponseClass() {
		return DeliveryTaskAddResponse.class;
	}

	@Override
	public void check() throws ApiRuleException {
		RequestCheckUtils.checkNotEmpty(deliveryInfoList, "deliveryInfoList");
		RequestCheckUtils.checkMaxLength(deliveryInfoList, 5242880, "deliveryInfoList");
	}
	
}
